home *** CD-ROM | disk | FTP | other *** search
-
- // ───────────────────────────────────────────────────────────────────
- // The Aurora Editor v2.0
- // Copyright 1993-1995 nuText Systems. All Rights Reserved Worldwide.
- //
- // Installation macro
- //
- // This macro installs all Aurora files to a user-specified path, and
- // also prompts the user for an editor style and color palette to use.
- // ───────────────────────────────────────────────────────────────────
-
- // compile time macros and function definitions
- include bootpath "define.aml"
-
- // message strings
- title = "Installation"
- cancelmsg = "Installation canceled"
- failmsg = "Installation failed"
- source_path = getpath (getbootpath)
-
- // create installation progress window
- createwindow
- setwinobj
- setframe ">b"
- setcolor border_color color white on gray
- setcolor text_color color black on gray
- settitle "Aurora v" + getversion + ' ' + title
- setwinctrl '≡'
- sizewindow 1 1 -1 -1 "rd"
- setborder "1i"
- display
-
- // get the install path
- install_path = upcase (ask "Enter installation path:" ''
- source_path title 'd')
- if not install_path then
- msgbox cancelmsg title
- destroywindow
- return
- end
-
- // add backslash if not present
- if install_path [0] <> "\\" then
- install_path = install_path + "\\"
- end
-
- writestr "Installation path is " + install_path
-
- // check if the install path exists
- if locatefile install_path '' 'd' then
- if (okbox "Path " + install_path +
- " already exists, install over it?" title) <> "Ok" then
- msgbox cancelmsg title
- destroywindow
- return
- end
-
- // ..if not, then create it
- else
- if (okbox "Path " + install_path +
- " is not found, create it?" title) <> "Ok" then
- msgbox cancelmsg title
- destroywindow
- return
- else
- if not createdir install_path then
- msgbox "Can't create path " + install_path + " - " + failmsg title
- destroywindow
- return
- end
- end
- install_path = getpath (qualify install_path)
- end
-
-
- // create the style menu
- menu "mstyle"
- item " &Aurora" "AU"
- item " &Brief" "BR"
- item " &QEdit/TSE" "QE"
- item " Word&Perfect" "WP"
- item " &WordStar/Borland IDE" "WS"
- end
-
- // get the editor style
- style = popup "mstyle" "Which editor style would you like to use?"
- destroybuf "mstyle"
- if not style then
- msgbox cancelmsg title
- destroywindow
- return
- end
-
- writeline
- writestr "Editor style is: " + style
- display
-
- // create the color palette menu
- menu "colors"
- item " &Blue and green" "blugreen"
- item " &Fluorescent" "fluoresc"
- item " &Green charcoal" "greench"
- item " &Red and blue" "redblue"
- item " &Wimbledon" "wimbledn"
- end
-
- // get the color palette to use
- palette = popup "colors" "Select a color palatte to install" 37
- destroybuf "colors"
- if not palette then
- msgbox cancelmsg title
- destroywindow
- return
- end
-
- writeline
- writestr "Editor color palette is: " + palette
- display
-
- // define all installation directories and files
- databuf "allfiles"
-
- // main files
- "\\"
- "a.exe"
- "a.x"
- "lib.x"
- "install.x"
- "install.aml"
- "color.aml"
- "config.aml"
- "define.aml"
- "ext.aml"
- "file_id.diz"
- "license.doc"
- "main.aml"
- "mouse.aml"
- "orderfrm.doc"
- "read.me"
- "syntax.aml"
- "syntax2.aml"
- "system.aml"
- "tran.aml"
- "vendor.doc"
-
- // doc files
- "doc\\"
- "function.dox"
- "language.dox"
- "quickfun.dox"
- "regexp.dox"
- "tips.dox"
- "user.dox"
-
- // macro files
- "macro\\"
- "calendar.aml"
- "clrchart.aml"
- "countchr.aml"
- "countwrd.aml"
- "delblank.aml"
- "deldup.aml"
- "drawbox.aml"
- "entab.aml"
- "example.aml"
- "fulldate.aml"
- "helplang.aml"
- "helpuser.aml"
- "keycodes.aml"
- "keydef.aml"
- "longline.aml"
- "palette.aml"
- "sumblock.aml"
- "tabs.aml"
- "utility.aml"
- "viewmem.aml"
-
- // palette files
- "palette\\"
- "blugreen.aml"
- "fluoresc.aml"
- "greench.aml"
- "redblue.aml"
- "wimbledn.aml"
-
- // style files
- "style\\"
- "aukbd.aml"
- "aumenu.aml"
- "brkbd.aml"
- "brmenu.aml"
- "qekbd.aml"
- "qemenu.aml"
- "wpkbd.aml"
- "wpmenu.aml"
- "wskbd.aml"
- "wsmenu.aml"
- end
-
- // check for same-path installation
- same_path = source_path == install_path
-
- // copy files
- repeat
- file = gettext
- if file [0] == '\\' then
- if file == '\\' then
- path = if? same_path '' install_path
- else
- path = file
- createdir install_path + path
- end
- elseif path then
- source = qualify file source_path
- if path == install_path then
- dest = qualify file install_path
- else
- if not locatefile source then
- source = qualify file source_path + path
- end
- dest = qualify file install_path + path
- end
-
- writeline
- writestr "Copying " + source + " to " + dest + "..."
- display
-
- if source <> dest then
- if copyfile source dest then
- if same_path then
- deletefile source
- end
- else
- // error copying files
- msgbox "Failed copying " + dest + ", " + failmsg title
- destroybuf "allfiles"
- destroywindow
- return
- end
- end
-
- // compile external macros
- if path == "macro\\" then
- // compile each macro, skip examples
- if file <> "example.aml" then
- writeline
- writestr "Compiling " + dest + "..."
- display
- error = compilemacro dest dest [1 : (sizeof dest) - 3] + 'X'
- if error then
- msgbox "Error (" + error + ") compiling macro " + dest
- end
- end
- end
- end
- until not down
-
- // destroy the file-list buffer
- destroybuf "allfiles"
-
- // routine to copy style/palette files to the main install path
- function copys (src_path sfile dfile)
- source = qualify sfile + ".AML" src_path
- dest = qualify dfile + ".AML" install_path
- writeline
- writestr "Copying " + source + " to " + dest
- display
- // make a backup copy
- copyfile dest (qualify dfile + ".OLD" install_path)
- if not copyfile source dest then
- // error copying files
- msgbox "Failed copying " + dest + ", " + failmsg title
- destroywindow
- return 1
- end
- return
- end
-
- style_path = install_path + "STYLE\\"
-
- // copy keyboard style file
- if copys style_path style + "KBD" "KBD" then
- return
- end
-
- // copy menu style file
- if copys style_path style + "MENU" "MENU" then
- return
- end
-
- // copy color palette file
- if copys install_path + "PALETTE\\" palette "COLOR" then
- return
- end
-
- writeline
- writestr "Recompiling the Editor..."
- display
-
- // recompile the editor
- save_boot = getbootpath
- setbootpath install_path
- error = regen
- setbootpath save_boot
-
- if error then
- msgbox "Compilation failed, " + failmsg title
- destroywindow
- return
- else
- writeline
- writestr "*** End of Installation *** "
- display
- msgbox "Installation is complete! Add " + install_path + " to your PATH." title
- msgbox "To run Aurora, execute " +
- (qualify "A.EXE" install_path) + " from the DOS command line."
- end
-
- // destroy the installation progress window
- destroywindow
-
- // return the install path if successful
- return install_path
-
-